package com.galen.chapter2.controller;

import com.galen.chapter2.entity.Chapter2User;
import com.galen.chapter2.service.Chapter2UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author GalenGao
 * @version Id: UserControoler.java, v 0.1 2022/2/24 12:20 上午 GalenGao Exp $$
 */
@RestController
@RequestMapping("/chapter2/user")
@RequiredArgsConstructor
public class Chapter2UserController {

    private final Chapter2UserService chapter2UserService;


    @GetMapping("/findByAddressAndEmail")
    public ResponseEntity<Chapter2User> findByAddressAndEmail(@RequestParam String address, @RequestParam String email) {
        return ResponseEntity.ok(chapter2UserService.findByEmailAndAddress(email, address));
    }

}
